<template>
  <div :class='s.wrap' v-if='showWarning'>
    <div :class='s.contentWrap'>
      <div :class='s.nameWrap'>
        <div :class="s.title">风险提示</div>
        <img src="~assets/images/close.png" :class="s.close" @click='showWarning = false'/>
      </div>
      <div :class='s.content'>
        <warning-text />
      </div>
      <div :class="s.btn" @click='sure'>确认</div>
    </div>
  </div>
</template>

<style lang="less" module='s'>
  .wrap{
    z-index: 10000;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    background: rgba(0,0,0,0.6);
    .contentWrap{
      width: 610px;
      height: 700px;
      margin: 317px auto;
      background: #fff;
      border-radius: 12px;
      overflow: hidden;
      text-align: left;
      .nameWrap{
        font-size: 32px;
        color: #808080;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        .title{
          flex: 1;
          padding: 28px 29px;
        }
        .close{
          width: 30px;
          height: 30px;
          margin: 28px 31px;
        }
      }
      .content{
        border-top: solid 1px #ddd;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        height: 520px;
        padding-top: 30px;
        padding-left: 10px;
        padding-right: 19px;
        margin-left: 30px;
        margin-right: 31px;
      }
      .btn{
        font-size: 30px;
	      color: #369fea;
        text-align: center;
        padding: 20px 0;
        box-shadow: 0 -3px 1px 1px #ddd;
      }
    }
  }
</style>

<script>
import WarningText from '@/components/dialog/WarningText'
import CommonUtil from '@/common/common.util'

export default {
  components: {
    WarningText
  },
  data () {
    return {
      showWarning: false,
      isShare: false
    }
  },
  mounted () {
    var dataURL = CommonUtil.getUrlParam('url')
    if (dataURL && dataURL !== '') this.isShare = true
    else {
      var hasConfirmWaring = localStorage.getItem('hasConfirmWaring')
      if (hasConfirmWaring === '0' || hasConfirmWaring === null) this.showWarning = true
    }
  },
  methods: {
    sure () {
      localStorage.setItem('hasConfirmWaring', '1')
      this.showWarning = false
    }
  }
}
</script>
